﻿namespace Beetle
{
    using System;
    using System.Runtime.CompilerServices;

    public class NetTcpException : Exception
    {
        internal const string _field_a = "<Modulus>{0}<Modulus/>";
        internal const string _field_b = "The message is too long";
        internal const string _field_c = "Cross-border access to data";
        internal const string _field_d = " IPAddress Error!";
        internal const string _field_e = "{0} Type not found!";
        internal const string _field_f = "{0} load data error!";
        internal const string _field_g = "Connection is not available";
        internal const string _field_h = "channel is disposed!";
        internal const string _field_i = "channel receive data timeout!";
        internal const string _field_j = "channel data process error!";
        internal const string _field_k = "channel must be connected";
        internal const string _field_l = "{0} config section not found!";
        internal const string _field_m = "{0} client pool config section not found!";
        internal const int _field_n = 0x2711;
        internal const int _field_o = 0x2714;
        internal const int _field_p = 0x2716;
        [CompilerGenerated]
        private int _field_q;

        public NetTcpException()
        {
        }

        public NetTcpException(string msg) : base(msg)
        {
        }

        public NetTcpException(Exception innererr, string msg) : base(msg, innererr)
        {
        }

        public static NetTcpException ClientDataProcessError(Exception innerexception)
        {
            return new NetTcpException(innerexception, "channel data process error!");
        }

        public static NetTcpException ClientIsDisposed()
        {
            return new NetTcpException("channel is disposed!");
        }

        public static NetTcpException ClientMustBeConnected()
        {
            return new NetTcpException("channel must be connected");
        }

        public static NetTcpException ClientPoolSectionNotFound(string name)
        {
            return new NetTcpException(string.Format("{0} client pool config section not found!", name));
        }

        public static NetTcpException ClientReceiveTimeout()
        {
            return new NetTcpException("channel receive data timeout!");
        }

        public static NetTcpException ConfigSelectionNotFound(string name)
        {
            return new NetTcpException(string.Format("{0} config section not found!", name));
        }

        public static NetTcpException ConnectionIsNotAvailable()
        {
            return new NetTcpException("Connection is not available");
        }

        public static NetTcpException DataOverflow()
        {
            return new NetTcpException("The message is too long") { ErrorNumber = 0x2711 };
        }

        public static NetTcpException IPAddressError()
        {
            return new NetTcpException(" IPAddress Error!") { ErrorNumber = 0x2716 };
        }

        public static NetTcpException NotInitialize()
        {
            return new NetTcpException("Beetle component did not initialize!\r\nCall TcpUtil.Setup!");
        }

        public static NetTcpException ObjectLoadError(string type, Exception innerexception)
        {
            return new NetTcpException(innerexception, string.Format("{0} load data error!", type));
        }

        public static NetTcpException PacketAnyalysisNotInitialize()
        {
            return new NetTcpException("Beetle Anyalysis  did not initialize!\r\nCall PacketAnalysis.Setup!");
        }

        public static NetTcpException ReadDataError(Exception innererror)
        {
            return new NetTcpException(innererror, "Cross-border access to data") { ErrorNumber = 0x2714 };
        }

        public static NetTcpException ReadToByteArraySegment()
        {
            return new NetTcpException("read to ByteArraySegment error!");
        }

        public static NetTcpException StringDecodingError(Exception innerexception)
        {
            return new NetTcpException(innerexception, "string decoding error!");
        }

        public static NetTcpException StringEncodingError(Exception innerexception)
        {
            return new NetTcpException(innerexception, "string encoding error!");
        }

        public static NetTcpException TypeNotFound(string name)
        {
            return new NetTcpException(string.Format("{0} Type not found!", name));
        }

        public int ErrorNumber
        {
            [CompilerGenerated]
            internal get
            {
                return this._field_q;
            }
            [CompilerGenerated]
            set
            {
                this._field_q = value;
            }
        }
    }
}

